<template>
<div class="layerRtb layerRtb-threecolumn">
    <three-title :title="{name:'公司考察'}"></three-title>
    <div class="layerRtb-scroll thinScroll" v-scrollHeight = "84">
        <div class="analyItem" v-if="flg==1">
            <p class="analyItemTit tx-center">公司考察</p>
            <div class="analyItemCon">
                    <p class="col-md-6">
                        <span class="cLightGray pr8">印象</span>
                        <span>{{this.stageInfo.investigate_impression ? this.stageInfo.investigate_impression : ''}}</span>
                    </p>
                    <p class="col-md-6">
                        <span class="cLightGray pr8">认可</span>
                        <span>{{this.stageInfo.investigate_approval ? (this.stageInfo.investigate_approval==0?'是':'否') : ''}}</span>
                    </p>

                    <div class="imgbox imgbox1 col-md-3" style="margin-top: 15px; position: absolute; right: 10px;top: 10px;">
                        <img src="https://gnr.rxjy.com/hrms/static/modules/cur/images/edit_img.png" title="编辑" width="20" class="fr pointer mr5" @click="flg=0">
                    </div>

            </div>
        </div>
        <div class="analyItem" v-if="flg==0">
            <p class="analyItemTit tx-center">公司考察</p>
            <div class="analyItemCon">
                <p class="col-md-6">
                    <span class="cLightGray">印象</span>
                    <input type="text" class="width120 evaluateStandard" name="set_stage_info_investigate_impression" v-model="investigateImpression"/>
                </p>
                <p class="col-md-5">
                    <span class="cLightGray pr8">认可</span>
                    <select name="set_stage_info_investigate_approval" class="width80" v-model="investigateApproval">
                        <option value="0">是</option>
                        <option value="1">否</option>
                    </select>
                </p>
                </div>
            <div class="imgbox imgbox2 " style="margin-top: 15px; position: absolute; right: 10px;top: 10px;">
                <img src="https://gnr.rxjy.com/hrms/static/modules/cur/images/save_img.png" title="保存" width="20" class="fl pointer mr5" name="update_stage_info_intention" @click="updateStageInfoByleId()">
                <img src="https://gnr.rxjy.com/hrms/static/modules/cur/images/goback_img.png" title="返回" width="20" class="fl pointer mr5" @click="flg=1">
            </div>
        </div>
    </div>
            <div class="analyItem">
            <p class="analyItemTit tx-center">综合</p>
            <div class="analyItemCon">
             <p class="fl">
                    <!-- <span class="circlemark circlemark-lightRed"> 待</span> -->
             </p>
            </div>
        </div>
</div>
</template>
<script>
import { mapGetters, mapMutations } from 'vuex'
import { updateStageInfoByleId } from '../../Resources/Api/index'
export default {
    data () {
        return {
            flg: 1,
            stageInfo: {}, // 用户信息
            investigateImpression: '', // 印象
            investigateApproval: 0 // 认可：0-是，1-否
        }
    },
    created () {
        this.stageInfo = this.$route.query.stageInfo
        this.investigateImpression = this.stageInfo.investigate_impression
        this.investigateApproval = this.stageInfo.investigate_approval
    },
    methods: {
        ...mapMutations({
            setUpdatePlate: `SET_UPDATE_PLATE`
        }),
        // 考察阶段修改用户的公司考察的印象和认可
        updateStageInfoByleId () {
            if (this.investigateImpression === null || this.investigateImpression === '') {
                layer.msg('请输入印象')
                return
            }
            updateStageInfoByleId({
                uid: this.leftInfo.uid, // 用户id
                investigateImpression: this.investigateImpression, // 印象
                investigateApproval: this.investigateApproval // 认可，0-是，1-否
            }).then(result => {
                if (Number(result.data.StatusCode) === 0) {
                    layer.msg('修改成功')
                    this.$router.push(this.$route.matched[1].path)
                }
            }).catch(err => {
                console.log('考察阶段修改用户的公司考察的印象和认可失败，异常信息：' + err)
            })
        }
    },
    computed: {
        ...mapGetters(['leftInfo'])
    }
}
</script>

